const rules = {
  goods_id: {
    required: true,
    int: {min: 1},
    aliasName: '商品名'
  },
  is_sale: {
    int: {min: 0, max: 1},
    default: 0,
    aliasName: '是否销售'
  },
  shop: {
    decimal: true,
    aliasName: '单件售价'
  },
  whole_shop: {
    decimal: true,
    aliasName: '整件售价'
  },
  thumbnail: {
    required: true,
    maxLength: 100,
    aliasName: '缩略图'
  },
  pc_img: {
    required: true,
    maxLength: 100,
    aliasName: '电脑端使用图片'
  },
  m_img: {
    required: true,
    maxLength: 100,
    aliasName: '手机端使用图片'
  },
  original_img: {
    required: true,
    maxLength: 100,
    aliasName: '原始图片'
  },
  keyword: {
    trim:true,
    maxLength: 100,
    aliasName: '搜索关键字'
  }
}
const messages = {
  required: '{name}不能为空'
}
module.exports = class extends think.Logic {
  postAction () {
    this.validate(rules, messages)
  }
  putAction () {
    this.validate(rules, messages)
  }
	saleAction () {
		this.allowMethods = 'post,put'
	}
};
